package exercises;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-02-23
 * Time:1:50
 */
public class Exercise3 {
    public static void main(String[] args) {
        HashMap<String, Integer> m = new HashMap<>();
        m.put("jack", 650);
        m.put("tom", 1200);
        m.put("smith", 2900);
        m.replace("jack", 2600);
        System.out.println(m);
        Set<Map.Entry<String, Integer>> entrySet = m.entrySet();
        for (Map.Entry<String, Integer> entry : entrySet) {
            int newValue = entry.getValue() + 100;
            entry.setValue(newValue);
        }
        System.out.println(m);
        for (Map.Entry<String, Integer> entry : entrySet) {
            System.out.println(entry.getKey());
        }
        for (Map.Entry<String, Integer> entry : entrySet) {
            System.out.println(entry.getValue());
        }
    }
}
